<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Lexicon</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.12.4.min.js"
	integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>

<script src="../docs-assets/Bigfoot.js"></script>
<link href="../docs-assets/Bigfoot.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Lexicon' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">index</a></li><li><a href="index.html#2">Chapter 2: Utilities</a></li><li><b>Lexicon</b></li></ul></div>
<p class="purpose">A lexicon for nouns, adjectives and verbs found in an Inter tree.</p>

<ul class="toc"><li><a href="2-lxc.html#SP3">&#167;3. Creating a lexicon</a></li><li><a href="2-lxc.html#SP6">&#167;6. Listing a lexicon</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>The lexicon is the part of the Index which gives an alphabetised list of
adjectives, nouns, verbs and other words which can be used in descriptions
of things: it's the nearest thing to an index of the meanings inside Inform.
It brings together meanings relating to various different Inform structures
under a single umbrella:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">COMMON_NOUN_TLEXE</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="comment-syntax"> a kind</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PROPER_NOUN_TLEXE</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax"> </span><span class="comment-syntax"> an instance of "object"</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ADJECTIVAL_PHRASE_TLEXE</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax"> </span><span class="comment-syntax"> the subject of a "Definition:"</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ENUMERATED_CONSTANT_TLEXE</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span><span class="plain-syntax"> </span><span class="comment-syntax"> e.g., "green" if colour is a kind of value and green a colour</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">VERB_TLEXE</span><span class="plain-syntax"> </span><span class="constant-syntax">5</span><span class="plain-syntax"> </span><span class="comment-syntax"> an ordinary verb</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PREP_TLEXE</span><span class="plain-syntax"> </span><span class="constant-syntax">7</span><span class="plain-syntax"> </span><span class="comment-syntax"> a "to be upon..." sort of verb</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MVERB_TLEXE</span><span class="plain-syntax"> </span><span class="constant-syntax">9</span><span class="plain-syntax"> </span><span class="comment-syntax"> a meaningless verb</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lemma</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">part_of_speech</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of those above</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">category</span><span class="plain-syntax">; </span><span class="comment-syntax"> textual description of said, e.g., </span><span class="extract"><span class="extract-syntax">"adjective"</span></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">general_pointer</span><span class="plain-syntax"> </span><span class="identifier-syntax">entry_refers_to</span><span class="plain-syntax">; </span><span class="comment-syntax"> depending on which part of speech</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gloss_note</span><span class="plain-syntax">; </span><span class="comment-syntax"> gloss on the definition, or </span><span class="extract"><span class="extract-syntax">NULL</span></span><span class="comment-syntax"> if none is provided</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex_package</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">link_to</span><span class="plain-syntax">; </span><span class="comment-syntax"> word number in source text</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">reduced_to_lower_case</span><span class="plain-syntax">; </span><span class="comment-syntax"> text converted to lower case for sorting</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sorted_next</span><span class="plain-syntax">; </span><span class="comment-syntax"> next in lexicographic order</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure index_lexicon_entry is accessed in 3/ve2 and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>A lexicon is then a set of entries. These are accumulated in no particular
order, then sorted.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_lexicon</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">unsorted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">first</span><span class="plain-syntax">; </span><span class="comment-syntax"> head of list in lexicographic order</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">inter_lexicon</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure inter_lexicon is accessed in 3/ve2 and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. Creating a lexicon.</b>And this is where that happens:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_lexicon</span><span class="plain-syntax"> *</span><span class="function-syntax">IndexLexicon::stock</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">IndexLexicon::stock</span></span>:<br/>Indexing API - <a href="1-ia.html#SP12">&#167;12</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">tree_inventory</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inv</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_lexicon</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lexicon</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_lexicon</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unsorted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Add verb entries</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP3_2" class="named-paragraph-link"><span class="named-paragraph">Add preposition entries</span><span class="named-paragraph-number">3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP3_3" class="named-paragraph-link"><span class="named-paragraph">Add adjective entries</span><span class="named-paragraph-number">3.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP3_4" class="named-paragraph-link"><span class="named-paragraph">Add common noun entries</span><span class="named-paragraph-number">3.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP3_5" class="named-paragraph-link"><span class="named-paragraph">Add proper noun entries</span><span class="named-paragraph-number">3.5</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP3_6" class="named-paragraph-link"><span class="named-paragraph">Create lower-case forms of all lexicon entries</span><span class="named-paragraph-number">3.6</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP3_7" class="named-paragraph-link"><span class="named-paragraph">Sort the lexicon into alphabetical order</span><span class="named-paragraph-number">3.7</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add verb entries</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">InterNodeList::array_sort</span><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">verb_nodes</span><span class="plain-syntax">, </span><span class="identifier-syntax">MakeSynopticModuleStage::module_order</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_INVENTORY_PACKAGES</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">inv</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">verb_nodes</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Metadata::read_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^meaningless"</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP5" class="function-link"><span class="function-syntax">IndexLexicon::new_entry_with_package</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^infinitive"</span><span class="plain-syntax">), </span><span class="constant-syntax">MVERB_TLEXE</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP5" class="function-link"><span class="function-syntax">IndexLexicon::new_entry_with_package</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^infinitive"</span><span class="plain-syntax">), </span><span class="constant-syntax">VERB_TLEXE</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">link_to</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">Metadata::read_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^at"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">, </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unsorted</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2" class="paragraph-anchor"></a><b>&#167;3.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add preposition entries</span><span class="named-paragraph-number">3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_INVENTORY_PACKAGES</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">inv</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">preposition_nodes</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP5" class="function-link"><span class="function-syntax">IndexLexicon::new_entry_with_package</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^text"</span><span class="plain-syntax">), </span><span class="constant-syntax">PREP_TLEXE</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">link_to</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">Metadata::read_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^at"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3" class="paragraph-anchor"></a><b>&#167;3.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add adjective entries</span><span class="named-paragraph-number">3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_INVENTORY_PACKAGES</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">inv</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">adjective_nodes</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lemma</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^text"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">lemma</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP4" class="function-link"><span class="function-syntax">IndexLexicon::new_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">lemma</span><span class="plain-syntax">, </span><span class="constant-syntax">ADJECTIVAL_PHRASE_TLEXE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax"> = </span><span class="string-syntax">"adjective"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">, </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unsorted</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_4" class="paragraph-anchor"></a><b>&#167;3.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add common noun entries</span><span class="named-paragraph-number">3.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_INVENTORY_PACKAGES</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">inv</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">kind_nodes</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Metadata::read_optional_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^is_subkind_of_object"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP4" class="function-link"><span class="function-syntax">IndexLexicon::new_entry</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^name"</span><span class="plain-syntax">), </span><span class="constant-syntax">COMMON_NOUN_TLEXE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">link_to</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">Metadata::read_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^at"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax"> = </span><span class="string-syntax">"noun"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">, </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unsorted</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_5" class="paragraph-anchor"></a><b>&#167;3.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add proper noun entries</span><span class="named-paragraph-number">3.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_INVENTORY_PACKAGES</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">inv</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">instance_nodes</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Metadata::read_optional_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^is_object"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP4" class="function-link"><span class="function-syntax">IndexLexicon::new_entry</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^name"</span><span class="plain-syntax">), </span><span class="constant-syntax">PROPER_NOUN_TLEXE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">link_to</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">Metadata::read_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^at"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax"> = </span><span class="string-syntax">"noun"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">, </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unsorted</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP4" class="function-link"><span class="function-syntax">IndexLexicon::new_entry</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^name"</span><span class="plain-syntax">), </span><span class="constant-syntax">ENUMERATED_CONSTANT_TLEXE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">link_to</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">Metadata::read_numeric</span><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^at"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax"> = </span><span class="string-syntax">"noun"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">, </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unsorted</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_6" class="paragraph-anchor"></a><b>&#167;3.6. </b>Before we can sort the lexicon, we need to turn its disparate forms of name
into a single, canonical, lower-case representation.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Create lower-case forms of all lexicon entries</span><span class="named-paragraph-number">3.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">, </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unsorted</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">reduced_to_lower_case</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lemma</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">reduced_to_lower_case</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Str::put</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">Characters::tolower</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_7" class="paragraph-anchor"></a><b>&#167;3.7. </b>The lexicon is sorted by insertion sort, which is not ideally fast, but
which is convenient when dealing with linked lists: there are unlikely to be
more than 1000 or so entries, so the speed penalty for insertion rather
than (say) quicksort is not great.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Sort the lexicon into alphabetical order</span><span class="named-paragraph-number">3.7</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">, </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">unsorted</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex2</span><span class="plain-syntax">, *</span><span class="identifier-syntax">last_lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sorted_next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">last_lex</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">last_lex</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex2</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sorted_next</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::cmp</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">reduced_to_lower_case</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">reduced_to_lower_case</span><span class="plain-syntax">) &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">last_lex</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">last_lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sorted_next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sorted_next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex2</span><span class="plain-syntax">; </span><span class="reserved-syntax">goto</span><span class="plain-syntax"> </span><span class="identifier-syntax">Inserted</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">last_lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sorted_next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sorted_next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Inserted:</span><span class="plain-syntax"> ;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>Lexicon entries are created by the following function:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="function-syntax">IndexLexicon::new_entry</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">IndexLexicon::new_entry</span></span>:<br/><a href="2-lxc.html#SP3_3">&#167;3.3</a>, <a href="2-lxc.html#SP3_4">&#167;3.4</a>, <a href="2-lxc.html#SP3_5">&#167;3.5</a>, <a href="2-lxc.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lemma</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">part</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lemma</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">lemma</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_of_speech</span><span class="plain-syntax"> = </span><span class="identifier-syntax">part</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">entry_refers_to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL_GENERAL_POINTER</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">gloss_note</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">reduced_to_lower_case</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">link_to</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>Or by these specialisations:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="function-syntax">IndexLexicon::new_entry_with_details</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lemma</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pos</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">category</span><span class="plain-syntax">, </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gloss</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP4" class="function-link"><span class="function-syntax">IndexLexicon::new_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">lemma</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lemma</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lemma</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax"> = </span><span class="identifier-syntax">category</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">gloss_note</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gloss</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="function-syntax">IndexLexicon::new_entry_with_package</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">IndexLexicon::new_entry_with_package</span></span>:<br/><a href="2-lxc.html#SP3_1">&#167;3.1</a>, <a href="2-lxc.html#SP3_2">&#167;3.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">infinitive</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">part</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><a href="2-lxc.html#SP4" class="function-link"><span class="function-syntax">IndexLexicon::new_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">part</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lemma</span><span class="plain-syntax"> = </span><span class="identifier-syntax">infinitive</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax"> = </span><span class="string-syntax">"verb"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pack</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Listing a lexicon.</b>Now for the bulk of the work. Entries appear in HTML paragraphs with hanging
indentation and no interparagraph spacing, so we need to insert regular
paragraphs between the As and the Bs, then between the Bs and the Cs, and so on.
Each entry consists of the wording, then maybe some icons, then an explanation
of what it is: for instance,
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">player</span><span class="character-syntax">'s holdall [icon]    noun, a kind of container</span>
</pre>
<p class="commentary">In a few cases, there is a further textual gloss to add.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">IndexLexicon::listing</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">IndexLexicon::listing</span></span>:<br/>Gazetteer Element - <a href="3-ge.html#SP1">&#167;1</a><br/>Lexicon Element - <a href="3-le.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_lexicon</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">proper_nouns_only</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">localisation_dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">LD</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">index_lexicon_entry</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lex</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">current_initial_letter</span><span class="plain-syntax"> = </span><span class="character-syntax">'?'</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">proper_noun_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sorted_next</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_of_speech</span><span class="plain-syntax"> == </span><span class="constant-syntax">PROPER_NOUN_TLEXE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">proper_noun_count</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">proper_nouns_only</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::begin_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::first_html_column</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lexicon</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex</span><span class="plain-syntax">; </span><span class="identifier-syntax">lex</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sorted_next</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">proper_nouns_only</span><span class="plain-syntax">) { </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_of_speech</span><span class="plain-syntax"> != </span><span class="constant-syntax">PROPER_NOUN_TLEXE</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> { </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_of_speech</span><span class="plain-syntax"> == </span><span class="constant-syntax">PROPER_NOUN_TLEXE</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">proper_nouns_only</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="identifier-syntax">proper_noun_count</span><span class="plain-syntax">/2)) </span><span class="identifier-syntax">HTML::next_html_column</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">current_initial_letter</span><span class="plain-syntax"> != </span><span class="identifier-syntax">Str::get_first_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">reduced_to_lower_case</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">); </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">); }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">current_initial_letter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get_first_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">reduced_to_lower_case</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">c</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">, </span><span class="string-syntax">"class=\"hang\""</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_1" class="named-paragraph-link"><span class="named-paragraph">Text of the actual lexicon entry</span><span class="named-paragraph-number">6.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_2" class="named-paragraph-link"><span class="named-paragraph">Icon with link to documentation, source or verb table, if any</span><span class="named-paragraph-number">6.2</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">switch</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_of_speech</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ADJECTIVAL_PHRASE_TLEXE:</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_5" class="named-paragraph-link"><span class="named-paragraph">Definition of adjectival phrase entry</span><span class="named-paragraph-number">6.5</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ENUMERATED_CONSTANT_TLEXE:</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_6" class="named-paragraph-link"><span class="named-paragraph">Definition of enumerated instance entry</span><span class="named-paragraph-number">6.6</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PROPER_NOUN_TLEXE:</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_4" class="named-paragraph-link"><span class="named-paragraph">Definition of proper noun entry</span><span class="named-paragraph-number">6.4</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">COMMON_NOUN_TLEXE:</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3" class="named-paragraph-link"><span class="named-paragraph">Definition of common noun entry</span><span class="named-paragraph-number">6.3</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">gloss_note</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" &lt;i&gt;%s&lt;/i&gt;"</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">gloss_note</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">proper_nouns_only</span><span class="plain-syntax">) { </span><span class="identifier-syntax">HTML::end_html_row</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); </span><span class="identifier-syntax">HTML::end_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">); }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b>In traditional dictionary fashion, we present the text in what may not be
the most normal ordering, in order to place the alphabetically important
part first: thus "see, to be able to" rather than "to be able to see".<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>
</p>

<ul class="footnotetexts"><li class="footnote" id="fn:1"><p class="inwebfootnote"><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> Compare "Gallifreyan High Council, continual incidences of madness and
treachery amongst the" in "Doctor Who: The Completely Useless Encyclopaedia",
eds. Howarth and Lyons (1996).
<a href="#fnref:1" title="return to text"> &#x21A9;</a></p></li></ul>
<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Text of the actual lexicon entry</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_of_speech</span><span class="plain-syntax"> == </span><span class="constant-syntax">PREP_TLEXE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Localisation::roman_t</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">LD</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Lx.ToBe"</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lemma</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lemma</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_2" class="paragraph-anchor"></a><b>&#167;6.2. </b>Main lexicon entries to do with verbs link further down the index page
to the corresponding entries in the verb table. We want to use numbered
anchors for these links, but we want to avoid colliding with numbered
anchors already used for other purposes higher up on the Phrasebook index
page. So we use a set of anchors numbered 10000 and up, which is guaranteed
not to coincide with any of those.
</p>

<p class="commentary">We omit source links to an adjectival phrase because these are polymorphic,
that is, the phrase may have multiple definitions in different parts of the
source text: so any single link would be potentially misleading.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Icon with link to documentation, source or verb table, if any</span><span class="named-paragraph-number">6.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_of_speech</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">COMMON_NOUN_TLEXE:</span>
<span class="plain-syntax">            </span><a href="2-iu.html#SP3" class="function-link"><span class="function-syntax">IndexUtilities::link_to_documentation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">VERB_TLEXE:</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PREP_TLEXE:</span>
<span class="plain-syntax">            </span><a href="2-iu.html#SP5" class="function-link"><span class="function-syntax">IndexUtilities::below_link_numbered</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">10000</span><span class="plain-syntax">+</span><span class="identifier-syntax">verb_count</span><span class="plain-syntax">++);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_of_speech</span><span class="plain-syntax"> != </span><span class="constant-syntax">ADJECTIVAL_PHRASE_TLEXE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">link_to</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="2-iu.html#SP2" class="function-link"><span class="function-syntax">IndexUtilities::link</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">link_to</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_3" class="paragraph-anchor"></a><b>&#167;6.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Definition of common noun entry</span><span class="named-paragraph-number">6.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3_1" class="named-paragraph-link"><span class="named-paragraph">Begin definition text</span><span class="named-paragraph-number">6.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">", "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Localisation::roman_t</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">LD</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Lx.KindOf"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Metadata::optional_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^index_superkind"</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3_2" class="named-paragraph-link"><span class="named-paragraph">End definition text</span><span class="named-paragraph-number">6.3.2</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_4" class="paragraph-anchor"></a><b>&#167;6.4. </b>Simply the name of an instance.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Definition of proper noun entry</span><span class="named-paragraph-number">6.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3_1" class="named-paragraph-link"><span class="named-paragraph">Begin definition text</span><span class="named-paragraph-number">6.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^index_kind"</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3_2" class="named-paragraph-link"><span class="named-paragraph">End definition text</span><span class="named-paragraph-number">6.3.2</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_5" class="paragraph-anchor"></a><b>&#167;6.5. </b>As mentioned above, an adjectival phrase can be multiply defined in
different contexts. We want to quote all of those.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Definition of adjectival phrase entry</span><span class="named-paragraph-number">6.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3_1" class="named-paragraph-link"><span class="named-paragraph">Begin definition text</span><span class="named-paragraph-number">6.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">": %S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">Metadata::required_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^index_entry"</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3_2" class="named-paragraph-link"><span class="named-paragraph">End definition text</span><span class="named-paragraph-number">6.3.2</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_6" class="paragraph-anchor"></a><b>&#167;6.6. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Definition of enumerated instance entry</span><span class="named-paragraph-number">6.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3_1" class="named-paragraph-link"><span class="named-paragraph">Begin definition text</span><span class="named-paragraph-number">6.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">", "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Localisation::roman_t</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">LD</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Lx.ValueOf"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Metadata::optional_textual</span><span class="plain-syntax">(</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">lex_package</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"^index_kind"</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-lxc.html#SP6_3_2" class="named-paragraph-link"><span class="named-paragraph">End definition text</span><span class="named-paragraph-number">6.3.2</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_3_1" class="paragraph-anchor"></a><b>&#167;6.3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Begin definition text</span><span class="named-paragraph-number">6.3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" ... &lt;i&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">proper_nouns_only</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%s"</span><span class="plain-syntax">, </span><span class="identifier-syntax">lex</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">category</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP6_3">&#167;6.3</a>, <a href="2-lxc.html#SP6_4">&#167;6.4</a>, <a href="2-lxc.html#SP6_5">&#167;6.5</a> and <a href="2-lxc.html#SP6_6">&#167;6.6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_3_2" class="paragraph-anchor"></a><b>&#167;6.3.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">End definition text</span><span class="named-paragraph-number">6.3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;/i&gt;"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-lxc.html#SP6_3">&#167;6.3</a>, <a href="2-lxc.html#SP6_4">&#167;6.4</a>, <a href="2-lxc.html#SP6_5">&#167;6.5</a> and <a href="2-lxc.html#SP6_6">&#167;6.6</a>.</li></ul>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-ir.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-im.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresssection"><a href="2-il.html">il</a></li><li class="progresssection"><a href="2-ii.html">ii</a></li><li class="progresssection"><a href="2-sas.html">sas</a></li><li class="progresssection"><a href="2-iu.html">iu</a></li><li class="progresssection"><a href="2-ir.html">ir</a></li><li class="progresscurrent">lxc</li><li class="progresssection"><a href="2-fi.html">fi</a></li><li class="progresssection"><a href="2-fs.html">fs</a></li><li class="progresschapter"><a href="3-tpt.html">3</a></li><li class="progresschapter"><a href="4-mc.html">4</a></li><li class="progressnext"><a href="2-fi.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

